import request from '@/utils/request'
import { makeFormData } from '@/utils/util'

export const briefApi = {
  list: 'web/cookbook/simples',
  delete: 'web/cookbook/simple',
  add: 'web/cookbook/simple',
  tongbangUrl: '/api/tongbang/auth_url',
  isCreated: 'api/tongbang/iscreated'
}

export function getBriefList (params = {}) {
  return request({
    url: briefApi.list,
    method: 'get',
    params
  })
}

export function briefSubmit (param) {
  return request({
    url: briefApi.add,
    method: 'post',
    data: param
  })
}

export function briefDelete (data) {
  return request({
    url: briefApi.delete,
    method: 'delete',
    data: makeFormData(data)
  })
}

export function getTongBangUrl () {
  return request({
    url: briefApi.tongbangUrl,
    method: 'post'
  })
}

export function getTongBangState () {
  return request({
    url: briefApi.isCreated,
    method: 'post'
  })
}
